<table width="100%"><tr><td width="20%">
<a href="../index.html">&lt; index</a><br />
<a href="../system/index.html">&lt; 3. System layer</a>
</td><td width="60%">
<p align="center">
=====================================<br />
3.3 Using a custom resolution for the fullscreen mode<br />
=====================================<br />
</p></td><td width="20%">
</td></tr></table>
<style type="text/css">
.code { color:#444444; background-color:#EEEEEE;}
pre { color:#444444; background-color:#EEEEEE;}
table.param td { border : 1px solid #000000; }
th { background-color: #44BBFF; color: #FFFFFF }
table.none td { border : 0 }
</style>
This function allows you to force the use of a specific resolution in fullscreen mode.<br/>
The default resolution depends on the root console size and the font character size.<br />
<p class="code"><pre>
C++ : static void TCODSystem::forceFullscreenResolution(int width, int height)
C   : void TCOD_sys_force_fullscreen_resolution(int width, int height)
Py  : sys_force_fullscreen_resolution(width, height)
</pre></p>
<table class="param">
<tr><th>Parameter</th><th>Description</th></tr>
<tr><td>width, height</td><td>Resolution to use when switching to fullscreen.<br />Will use the smallest available resolution so that :<br />resolution width &gt;= width and resolution width &gt;= root console width * font char width<br />resolution width &gt;= height and resolution height &gt;= root console height * font char height<br /></td></tr>
</table>
Example :<br />
<p class="code"><pre>
C++ : TCODSystem::forceFullscreenResolution(800,600); // use 800x600 in fullscreen instead of 640x400
      TCODConsole::initRoot(80,50,"",true); // 80x50 console with 8x8 char => 640x400 default resolution
C   : TCOD_sys_force_fullscreen_resolution(800,600); 
      TCOD_console_init_root(80,50,"",true);
Py  : libtcod.sys_force_fullscreen_resolution(800,600)
      libtcod.console_init_root(80,50,"",True)
</pre></p>
<br />
You can get the current screen resolution with getCurrentResolution. You can use it for example to get the desktop resolution before initializing the root console.<br />
<p class="code"><pre>
C++ : static void TCODSystem::getCurrentResolution(int *width, int *height)
C   : void TCOD_sys_get_current_resolution(int *width, int *height)
Py  : sys_get_current_resolution() # returns w,h
</pre></p>
<table class="param">
<tr><th>Parameter</th><th>Description</th></tr>
<tr><td>width, height</td><td>Contain current resolution when the function returns.</td></tr>
</table>
Example :<br />
<p class="code"><pre>
C++ : int w,h;
      TCODSystem::getCurrentResolution(&w,&h); // get desktop resolution
      TCODConsole::initRoot(w/8,h/8,"",true); // sets the console size so that it fills the desktop with a 8x8 font
C   : TCOD_sys_get_current_resolution(&w,&h); 
      TCOD_console_init_root(w/8,h/8,"",true);
Py  : w,h=libtcod.sys_get_current_resolution() 
      libtcod.console_init_root(w/8,h/8,"",True)
</pre></p>
